import { getRandomDateTime, getNowDate, getFeatureDate } from '../../../utils'
import Mock from 'mockjs'
const { Random } = Mock
export const oauth2ClientMock = pageSize => {
  const result: any[] = []
  for (let i = 0; i < pageSize; i++) {
    result.push({
      id: i + 1,
      clientId: Mock.mock('@id'), // 客户端 id
      secret: Mock.mock('@word'), // 客户端密钥
      name: Mock.mock('@ctitle'), // 客户端应用名称
      logo: Random.image('100x100'), // 客户端应用 logo
      description: Mock.mock('@csentence'), // 应用描述
      status: Random.integer(0, 1), // 状态
      accessTokenValiditySeconds: Random.integer(5, 10) * 60, // 访问令牌有效期，单位：秒
      refreshTokenValiditySeconds: Random.integer(30, 60) * 60 * 60 * 24, // 刷新令牌有效期，单位：秒
      redirectUris: [Mock.mock('@url')], // 可重定向的 URI 地址
      'autoApprove|1': true, // 是否自动授权
      authorizedGrantTypes: ['authorization_code', 'refresh_token'], // 授权类型
      scopes: ['user.read', 'user.write'], // 授权范围
      authorities: [], // 权限
      resourceIds: [], // 资源
      additionalInformation: '', // 附加信息
      'isAdditionalInformationJson|1': true,
      creator: '1',
      create_time: getRandomDateTime(getFeatureDate(-10), getNowDate()),
      updater: '',
      update_time: '',
      deleted: false,
      deleted_time: ''
    })
  }
  return result
}
